/**
 * @author Yura Zhloba
 */
package com.flashdevs.yzh.log
{
public class LogMsg
{
	public var level : int;
	public var category : String;
	public var message : String;

	public function LogMsg(level : int, category : String, message : String)
	{
		this.level = level;
		this.category = category;
		this.message = message;
	}

	public function getFormattedLevel() : String
	{
		var data : String = "";
		switch(level)
		{
			case LogLevel.FATAL.code: data = "<span class='fatal'>FATAL</span>"; break;
			case LogLevel.ERROR.code: data = "<span class='error'>ERROR</span>"; break;
			case LogLevel.WARN.code: data = "<span class='warn'>WARN </span>"; break;
			case LogLevel.INFO.code: data = "<span class='info'>INFO </span>"; break;
			case LogLevel.DEBUG.code: data = "<span class='debug'>DEBUG</span>"; break;
		}
		return data;
	}

	public function getFormattedCategory(length : int) : String
	{
		var data : String = category;
		while(data.length < length) data += " ";
		data = "<span class='category'>" + data
		data += "</span>";
		return data;		
	}
}
}
